package com.framework.bdf4j.msg.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.framework.bdf4j.msg.entity.domain.SysMsgReceiver;
import com.framework.bdf4j.msg.entity.vo.SysUserVO;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 消息接收人
 *
 * @author shan.deng
 * @date 2020-08-03 11:35:03
 */
@Mapper
public interface SysMsgReceiverMapper extends BaseMapper<SysMsgReceiver> {

    /**
     * 查询自己未读消息数量
     * @param userId
     * @return
     */
    Integer countReceiverMessage(Integer userId);

    /**
     * 将某条消息置为已读
     * @param userId
     * @return
     */
    Integer updateReceiverMessageRead(@Param("userId") Integer userId, @Param("msgId") Integer msgId);

    /**
     * 根据部门Id数组查询所包含的用户
     * @param deptIds
     * @return
     */
    List<SysUserVO> queryUserByDeptIds(@Param("deptIds") List<Integer> deptIds);

    /**
     * 根据角色Id数组查询所包含的用户
     * @param roleIds
     * @return
     */
    List<SysUserVO> queryUserByRoleIds(@Param("roleIds") List<Integer> roleIds);

    /**
     * 根据消息Id查询要发送的人员信息
     * @param msgId
     * @return
     */
    List<SysUserVO> queryUserByMsgId(@Param("msgId") Integer msgId);
}
